# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-speechrecognition
pkgname=('python2-speechrecognition' 'python-speechrecognition')
_pkgname=speech_recognition
pkgver=3.8.1
pkgrel=11
pkgdesc='Library for performing speech recognition, with support for several engines and APIs, online and offline.'
arch=('any')
url='https://pypi.org/project/speechrecognition/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools' 'python-standard-aifc')
source=("https://github.com/Uberi/speech_recognition/archive/$pkgver.tar.gz")
sha512sums=('555a4e7b2f0cb4f7adac8a0d7f1bc4071564a021a40b5ae75ea61e4b6a3b17b974672f0350ef06150bfa1711307e4af24603c8fc78aaf8a51fc82e73413815ac')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-speechrecognition() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-speechrecognition() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

